load("//bazel:ray.bzl", "ray_cc_library")

ray_cc_library(
    name = "object_manager",
    srcs = ["object_manager.cc"],
    hdrs = ["object_manager.h"],
    deps = [
        "spilled_object_reader",
        ":chunk_object_reader",
        ":object_buffer_pool",
        ":object_directory",
        ":object_manager_common",
        ":pull_manager",
        ":push_manager",
        "//:object_manager_rpc",
        "//src/ray/common:asio",
        "//src/ray/common:id",
        "//src/ray/common:ray_config",
        "//src/ray/common:status",
        "//src/ray/object_manager/plasma:plasma_store_server_lib",
        "//src/ray/protobuf:common_cc_proto",
        "//src/ray/protobuf:node_manager_cc_proto",
        "@com_google_absl//absl/container:flat_hash_map",
    ],
)

ray_cc_library(
    name = "push_manager",
    srcs = ["push_manager.cc"],
    hdrs = ["push_manager.h"],
    deps = [
        "//src/ray/common:id",
        "//src/ray/stats:stats_metric",
        "@com_google_absl//absl/container:flat_hash_map",
    ],
)

ray_cc_library(
    name = "pull_manager",
    srcs = ["pull_manager.cc"],
    hdrs = ["pull_manager.h"],
    deps = [
        ":object_manager_common",
        ":ownership_object_directory",
        "//:object_manager_rpc",
        "//src/ray/common:id",
        "//src/ray/common:ray_config",
        "//src/ray/common:ray_object",
        "//src/ray/common:status",
        "//src/ray/stats:stats_metric",
        "//src/ray/util:container_util",
        "//src/ray/util:counter_map",
        "@boost//:asio",
        "@boost//:bind",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/time",
    ],
)

ray_cc_library(
    name = "ownership_object_directory",
    srcs = ["ownership_object_directory.cc"],
    hdrs = ["ownership_object_directory.h"],
    deps = [
        ":object_directory",
        "//:worker_rpc",
        "//src/ray/common:asio",
        "//src/ray/common:id",
        "//src/ray/gcs/gcs_client:gcs_client_lib",
        "//src/ray/pubsub:subscriber_lib",
        "@com_google_absl//absl/container:flat_hash_map",
    ],
)

ray_cc_library(
    name = "object_directory",
    hdrs = ["object_directory.h"],
    deps = [
        ":object_manager_common",
        "//src/ray/common:asio",
        "//src/ray/common:id",
        "//src/ray/common:status",
        "//src/ray/gcs/gcs_client:gcs_client_lib",
    ],
)

ray_cc_library(
    name = "object_buffer_pool",
    srcs = ["object_buffer_pool.cc"],
    hdrs = ["object_buffer_pool.h"],
    deps = [
        ":memory_object_reader",
        "//src/ray/common:id",
        "//src/ray/common:status",
        "//src/ray/util:logging",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/time",
    ],
)

ray_cc_library(
    name = "object_manager_common",
    srcs = ["common.cc"],
    hdrs = ["common.h"],
    deps = [
        "//src/ray/common:id",
        "//src/ray/common:ray_config",
        "//src/ray/common:status",
        "@com_google_absl//absl/strings",
    ],
)

ray_cc_library(
    name = "object_manager_grpc_client_manager",
    hdrs = ["grpc_client_manager.h"],
    deps = [
        "//:grpc_client",
        "//:rpc_client_call",
        "//src/ray/common:ray_config",
        "@com_google_absl//absl/synchronization",
        "@com_github_grpc_grpc//:grpc++",
    ],
)

ray_cc_library(
    name = "memory_object_reader",
    srcs = ["memory_object_reader.cc"],
    hdrs = ["memory_object_reader.h"],
    deps = [
        ":object_reader",
        "//src/ray/object_manager/plasma:plasma_client",
    ],
)

ray_cc_library(
    name = "chunk_object_reader",
    srcs = ["chunk_object_reader.cc"],
    hdrs = ["chunk_object_reader.h"],
    deps = [
        ":object_reader",
        "//src/ray/util:logging",
    ],
)

ray_cc_library(
    name = "spilled_object_reader",
    srcs = ["spilled_object_reader.cc"],
    hdrs = ["spilled_object_reader.h"],
    deps = [
        ":object_reader",
        "//src/ray/util:logging",
        "@com_google_absl//absl/types:optional",
        "@com_google_googletest//:gtest_prod",
    ],
)

ray_cc_library(
    name = "object_reader",
    hdrs = ["object_reader.h"],
    deps = ["//src/ray/protobuf:common_cc_proto"],
)
